using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public abstract class UpgradeButton : MonoBehaviour {
	
	Text myText;
	protected GameManager gm;
	
	// Use this for initialization
	void Start () {
		gm = GameObject.FindObjectOfType<GameManager>();
	}
	
	protected abstract int CostForLevel();

	protected abstract string UpgradeName();
	
	// Update is called once per frame
	void Update () {
		if(myText == null) {
			myText = transform.Find ("Text").GetComponent<Text>();
		}
		
		myText.text = UpgradeName() + " - $" + CostForLevel().ToString("f0");
		
		if(gm.score < CostForLevel()) {
			this.GetComponent<Image>().color = Color.grey;
		}
		else {
			this.GetComponent<Image>().color = Color.white;
		}
	}
	
	abstract public void Clicked();
	
}
